//
//  DBOperation.h
//  IconMaster
//
//  Created by nhn on 14-9-5.
//  Copyright (c) 2014年 为为. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CIconView.h"
#import "ImageGridTableViewController.h"

#define GROUP_KEY_TITLE			@"GroupTitle"
#define GROUP_KEY_DELETE		@"GroupDeletable"
#define GROUP_KEY_ID			@"GroupID"
#define GROUP_KEY_DOWNLOAD		@"GroupDownload"
#define GROUP_KEY_GLOBALPATH	@"GroupGlobalPath"
#define GROUP_KEY_SAVEDICON		@"GroupSavedIcon"

#define DEFAULT_ICON_ID         @(-2)
#define GROUP_KEY_SAVEDICON_ID	-2


@interface DBOperation : NSObject

+ (NSMutableArray*)iconGroupArray;
+ (NSMutableArray*)skinGroupArray;
+ (NSMutableArray*)frameGroupArray;
+ (NSMutableArray*)decoGroupArray;

+ (NSArray*)savedIconArray;
+ (void)deleteSavedIconWithID:(int)iconID;
+ (int)insertSavedIconWithIconImage:(UIImage*)image;
+ (int)insertSavedIconWithIconView:(CIconView*)view;
+ (CIconView*)getIconViewFromSavedIconWithID:(int)iconID;
+ (UIImage*)getImageForSavedIconDict:(NSDictionary*)iconDict;
+ (CIconView*)getIconViewForSavedIconDict:(NSDictionary*)iconDict;

+ (NSDictionary*)groupDictWithGroupID:(int)groupID;
+ (NSArray*)groupArrayWithType:(NSString*)type;
+ (NSArray*)imageArrayForGroupID:(int)groupID;
+ (NSArray*)imageArrayForGroupID:(int)groupID startIndex:(int)start count:(int)count;
+ (int)imageCountForGroupID:(int)groupID;

+ (void)getCoverImageForGroupDict:(NSDictionary*)groupDict asyncBlock:(void(^)(UIImage* image))block;
+ (void)getImageForImageDict:(NSDictionary*)imageDict
				 ofGroupDict:(NSDictionary*)groupDict
				  asyncBlock:(void (^)(UIImage* image))block;
+ (UIImage*)getImageForPath:(NSString*)path;

+ (NSArray*)imageArrayForImageGridTableViewController:(ImageGridTableViewController*)controller
										imageGridCell:(NImageGridCell*)cell
										  atIndexPath:(NSIndexPath*)indexPath
										withGroupDict:(NSDictionary*)groupDict;


+ (int)getIDFromImage:(UIImage*)image;

+ (BOOL)isImageBuildIn:(NSString*)imagePath;
+ (BOOL)isImageDefaultIcon:(NSString*)imagePath;

+ (NSString*)admobID;

+ (NSString*)admobPageID;

+ (void)clearCache;

+ (NSString*)baseUrl;

+ (BOOL)isAppListEnabled;

+ (BOOL)isRate2UnlockEnabled; 
+ (void)setRate2UnlockEnable:(BOOL)enabled;

+ (BOOL)isUserRated;
+ (void)setUserRated:(BOOL)rated;

+ (NSArray*)myAppIdList;

@end
